package com.movie.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.http.HttpStatus;

/**
 * @author Liu Jiaquan
 * @Description
 * @date 2024/7/1 17:54
 */
@Data
@AllArgsConstructor
public class HttpResult<T> {
    private int code;
    private String msg;
    private T data;


    public static <T> HttpResult<T> success(){
        return new HttpResult<>(200, "请求成功", null);
    }
    public static <T> HttpResult<T> success(T data){
        return new HttpResult<>(200, "请求成功", data);
    }
    public static <T> HttpResult<T> success(T data,String msg){
        return new HttpResult<>(200, msg, data);
    }

    public static <T> HttpResult<T> error(String msg){
        return new HttpResult<>(500, msg, null);
    }
}
